﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;


namespace console.demo.senior
{
    public struct Book
    {
        public string Title;
        public string Author;
        public decimal Price;
        public bool Paperback;
        public Book(string title, string author, decimal price, bool paperback)
        {
            Title = title;
            Author = author;
            Price = price;
            Paperback = paperback;

        }
    }
    public delegate void ProcessBookCallback(Book book);
    public class BookDB
    {
        public BookDB() { }

        ArrayList arrayList = new ArrayList();
        public void Add(string title, string author, decimal price, bool paperback)
        {
            arrayList.Add(new Book(title, author, price, paperback));
        }

        public void ProcessPaperbackBooks(ProcessBookCallback processBookCallback)
        {
            foreach (Book book in arrayList)
            {
                if (book.Paperback)
                {
                    processBookCallback(book);
                }
            }
        }
    }
}
